package Lambda;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Consumer;

import org.junit.Test;

import com.google.gson.Gson;

import calendar.Person;

public class Test111 {
	
	/**
	 * 实现接口
	 */
	@Test
	public void Lambda(){
		
		ExecutorService exec = Executors.newCachedThreadPool();
		
		for(int x = 1;x<10;x++){
			
			
			exec.execute(()->{
				
				System.out.println("haha");
			});
		}
		exec.shutdown();
	}
	
	/**
	 * 实现循环遍历
	 */
	@Test
	public void xunhuan(){
		Gson gson = new Gson();
		Person person = new Person();
		Person person1 = new Person();
		person.setAge(11);
		person1.setAge(12);
		person.setName("账单");
		person1.setName("lisi");
		List<Person> asList = Arrays.asList(person,person1);
		asList.forEach(person11->System.out.println(gson.toJson(person11)));
		
		
		System.out.println("最后"+gson.toJson(asList));
		
	
	}
}
